Learning Objectives

After completing this lesson, you’ll be able to: 

Prototyping

In the classical sense, prototyping means creating an incomplete application as a way to evaluate the feasibility of a project.

Here we'll stretch the definition to mean how to build a complex FME project incrementally; starting with an empty workspace and building it piece by piece to deliver a result that matches the final specification.

We will cover the techniques used for building a workspace incrementally, and how to handle data that is rejected by a transformer.

Incremental Development

The key development technique for FME workspaces is incremental updates.

The steps to this technique are:

Although a range of 3-10 transformers is an arbitrary number, the more transformers you add, the more difficult it would be to identify the source of any problems. Beyond ten transformers is the point at which you should consider chopping that process into smaller sections.

Here an author has planned their workspace by laying it out as a set of bookmarks on the canvas:

Bookmarks used to plan workspaces sections

Now the author can complete and test each section at a time, keeping the overall goal in mind at the same time.

Note

It can be all too easy to start developing a workspace and forget to save it at all! FME keeps a recovery file as soon as the workspace is saved for the first time, but until then you are running the risk of an irretrievable loss.

Source Data

When the FME project is large and complex, it's likely that the source data will be large and complex too. So when creating a workspace in small increments, testing each part in turn, it's better to avoid using the entire dataset.

It's better to use a sample of source data for testing. In fact, it's better to create a small sample of data - extracting it from your source and writing to a neutral format like FFS - rather than randomly sampling the data for each test run.

Sampling is particularly useful for databases because it also avoids the problems of waiting for network traffic and database responses.

Using sampling with a Tiler

Here the workspace author is extracting a section of source data by reading from a database, splitting it into tiles, and writing just one tile to the FFS format. This one tile can be used for prototyping a solution in a way that is representative of the entire source database table.

Another transformer to use would be the Sampler, although the features selected by it would not be spatially adjacent.

Version Control

When making a set of incremental changes to a workspace, it's easy to work on a single workspace file only. However, there are various problems with this:

Therefore, it is better to keep versioned workspaces, where a different copy is kept for each set of revisions. This precaution can be taken manually within the file system, or by using a version control system like Git.

In fact, it is a good idea to keep and version all materials related to an FME project, including:

It's better not to store any information that is personal or that includes passwords. Also, there's no need to store temporary files.

You can use a few methods to keep track of version and editing history:

Note

⭐ New for 2022.0FME Workbench has a new tool (in Tech Preview) to help you collaborate and track changes in your workspaces: Workspace Compare and Merge. Learn more with Visually Compare and Merge Workflows.

Note

FME Server has a version control system built in. Even if you don't have an FME Server license, you can still install it for use as a repository system for workspaces and related files.

Rejected Features

An important part of any workflow is handling data that fails to process. For example, where a feature with no geometry is sent into a geometry-based transformer like the AreaBuilder.

FME handles such failures by outputting the data through <Rejected> ports, which are found on many transformers:

Rejected ports

A parameter exists to control the action of <Rejected> ports and gives the workspace author a choice over what action to take.

When a feature is rejected, the translation will stop and a red circle with a number will appear on the <Rejected> port. You can click on the cache to inspect the feature and determine why it was rejected:

A Rejected port with a feature cache

Rejected Feature Handling

The parameter to control the handling of rejected features can be found in the Navigator window, under Workspace Parameters:

The Rejected Feature Handling parameter in the Navigator

The two options are Terminate Translation and Continue Translation.

When the parameter is set to terminate, then a feature that exits via a <Rejected> port causes the translation to stop. To visually denote this, the <Rejected> ports have a small black marker on them.

When the parameter is set to continue, then the translation will continue, regardless of how many features exit <Rejected> ports. In that case, the small black marker is removed:

Continue Translation mode removes the black dot from Rejected ports

In terminate mode, a rejected feature gets written to the log window with the error message:

The below feature caused the translation to be terminated

There will also be an error message relating to the transformer:

Intersector_<Rejected>(TeeFactory): Intersector_<Rejected>: Termination Message: 'Intersector output a <Rejected> feature.

This error is useful because it tells the author which transformer experienced the failure.

Note

To quickly find these error messages you can filter the Translation Log by clicking on the Errors button.

Mixed Mode

In terminate mode, a rejected feature will not cause the translation to stop, provided that the <Rejected> port is connected to a further object:

Terminate mode with a connected Rejected port

In short, an author can create a mixed mode, where some transformers stop the translation on rejecting a feature (the Intersector above), but others will handle the feature another way (the Bufferer). That way the author can try to handle rejected features that are expected, but stop the translation if there are truly unexpected failures.

Note

Generally:

  • Terminate mode is useful if you do not want any features to be rejected. You want to verify all your data is correct.
  • Continue mode is useful if you don't care if a feature is rejected. You assume rejections are happening because of bad data and don't want to use those records.
  • Mixed mode is useful if you want to pick and choose which transformers' <Rejected> ports you care about.

Feature Counts and Inspection

In continue mode, features that exit a <Rejected> port are counted and saved for inspection:

A Rejected port with a feature cache using Continue mode

Features will be saved for inspection even if there is no Logger or other transformer attached. The number tells us how many features were rejected and the green icon can be clicked to inspect the data.